@echo off
SETLOCAL EnableDelayedExpansion

REM 指定你的Git仓库路径
set "REPO_PATH="K:\ai\ai.llm"

REM 切换到指定的Git目录
cd /d "%REPO_PATH%"

REM Pull最新更新
git pull

REM 获得当前日期和时间作为commit消息
for /f "tokens=1,2,3,4,5 delims=/:" %%i in ('echo.^| date /t') do (
    set CURRENT_DATE=%%i-%%j-%%k-%%l
)

REM 使用当前日期和时间作为commit消息提交更改
set COMMIT_MESSAGE=Update from script on %CURRENT_DATE%

REM 提交本地修改，这里假设你已经有了要提交的更改
git add .

REM 使用当前日期和时间作为commit消息提交更改
git commit -m "%COMMIT_MESSAGE%"

REM Push到远程库
git push

if errorlevel 1 (
    echo An error occurred during the push operation.
) else (
    echo Git update and push completed successfully.
)

ENDLOCAL